package top.vanchor.flexible.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;
import top.vanchor.flexible.entity.model.MenuMeta;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author Ding
 * @since 2022-01-27
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@EqualsAndHashCode(callSuper = false)
@TableName(value = "back_auth_rule")
public class BackAuthRule implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 权限id
     */
    @JsonProperty("id")
    @TableId(value = "r_id", type = IdType.AUTO)
    private Integer ruleId;

    /**
     * 菜单标题
     */
    @JsonProperty("title")
    @TableField(value = "title")
    private String title;

    /**
     * 菜单url
     */
    @JsonProperty("path")
    @TableField(value = "path")
    private String path;

    /**
     * 状态：-1删除，0禁用，1正常
     */
    @JsonProperty("status")
    @TableField(value = "status")
    private String status;

    /**
     * 图标
     */
    @JsonProperty("icon")
    @TableField(value = "icon")
    private String icon;

    /**
     * 0：后台，1：平台
     */
    @JsonProperty("cate")
    @TableField(value = "cate")
    private String cate;

    /**
     * 父级id
     */
    @JsonProperty("pid")
    @TableField(value = "`pid`")
    private Integer pid;

    /**
     * 排序（从小到大正序排列）
     */
    @JsonProperty("sort")
    @TableField(value = "`sort`")
    private Integer sort;

    /**
     * 创建时间
     */
    @JsonProperty("createTime")
    @TableField(value = "create_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd", timezone = "Asia/Shanghai")
    private Date createTime;

    /**
     * 修改时间
     */
    @JsonProperty("updateTime")
    @TableField(value = "update_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd", timezone = "Asia/Shanghai")
    private Date updateTime;

    /**
     * 是否不可关闭
     */
    @JsonProperty("noClosable")
    @TableField(value = "no_closable")
    private boolean noClosable;

    /**
     * 是否隐藏面包屑
     */
    @JsonProperty("breadcrumbHidden")
    @TableField(value = "breadcrumb_hidden")
    private boolean breadcrumbHidden;

    /**
     * 是否隐藏菜单
     */
    @JsonProperty("hidden")
    @TableField(value = "hidden")
    private boolean hidden;

    @JsonProperty("groupRuleLists")
    @TableField(value = "`groupRuleLists`")
    private String groupRuleLists;

    @JsonProperty("groupRuleLists1")
    @TableField(exist = false)
    private String groupRuleLists1;

    @JsonProperty("component")
    private String component;

    @JsonProperty("name")
    private String name;

    @JsonProperty("disabled")
    private Integer disabled;

    @JsonProperty("meta")
    @TableField(exist = false)
    private MenuMeta meta;

    /**
     * 工具list
     */
    @JsonProperty("children")
    @TableField(exist = false)
    private List<BackAuthRule> children = new ArrayList<>();


}
